﻿@{
    ViewBag.Title = "用户管理";
}
@using PagedList
@using PagedList.Mvc
@model PagedList.IPagedList<zqdn.Web.ViewModels.CaseTplViewModel>

<div class="pageheader">
    <h2><i class="fa fa-user"></i> 病例审核 </h2>
</div>

<div class="contentpanel">
    <div class="row">
        <a href="/admin/Case/ExportExcel" class="btn btn-primary">导出病例明细</a>
    </div>
    <div class="row form-group">
        <div class="col-3 pull-right"  style="margin:0 5px;">
            <button class="btn btn-primary" id="search">查找</button>
        </div>
        <div class="col-3 pull-right">
            <input placeholder="病例编号" class="form-control caseId" />
        </div>
    </div>
    <div class="row">
        <div class="table-responsive">
            <table class="table table-hidaction table-hover">
                <thead>
                    <tr>
                        <th>病例编号</th>
                        <th>日期</th>
                        <th>种类</th>
                        <th>姓名</th>
                        <th>性别</th>
                        <th>年龄</th>
                        <th>体重</th>
                        <th>医院</th>
                        <th>医生</th>
                        <th>科室</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                  @foreach (var item in Model)
                    {
                        <tr>
                            <td>@item.ID</td>
                            <td>@item.WriteTime.ToShortDateString()</td>
                            <td>
                                @if (item.Type == 1)
                                {
                                    <span>艾诺联合病例收集</span>
                                }
                                else if (item.Type == 0)
                                {
                                    <span>凯特力吸入麻醉病例收集</span>
                                }
                            </td>
                            <td>@item.Name</td>
                            <td>@item.Sex</td>
                            <td>@item.Age</td>
                            <td>@item.Weight</td>
                            <td>@item.ActiveHos</td>
                            <td>@item.ActiveID</td>
                            <td>@item.DepNo</td>
                            <td>
                                @if (item.Status == 1)
                                {
                                    <a data-caseid="@item.ID" href="javascript:void(0)" class="notpass">取消审核通过</a>
                                }
                                else
                                {
                                    <a data-caseId="@item.ID" href="javascript:void(0)" class="pass">审核通过</a>
                                }
                                &nbsp;&nbsp;
                                <a href="/admin/Case/CaseInfo?id=@item.ID">查看详情</a>
                            </td>
                        </tr>
                    }
                </tbody>
            </table>
        </div><!-- table-responsive -->
        @Html.PagedListPager((PagedList.IPagedList)Model, page => Url.Action("Index", new
                           {
                               page,
                               adName = ViewBag.AdName
                           })
                            , PagedListRenderOptions.EnableUnobtrusiveAjaxReplacing(
                            new PagedListRenderOptions()
                            {
                                LinkToPreviousPageFormat = "上一页",
                                LinkToNextPageFormat = "下一页",
                                MaximumPageNumbersToDisplay = 5
                            }, new AjaxOptions()
                            {
                                HttpMethod = "GET"
                            }))
    </div><!-- row -->
</div>

<script type="text/javascript">
    $(function () {
        $(".pass").on("click", function () {
            var id = $(this).attr("data-caseId");
            $.post("/admin/Case/pass", { id: id }, function (data) {
                if (data == "1") {
                    location.reload();
                }
            })
        });
        $(".notpass").on("click", function () {
            var id = $(this).attr("data-caseId");
            $.post("/admin/Case/notpass", { id: id }, function (data) {
                if (data == "1") {
                    location.reload();
                }
            })
        });
        $("#search").on("click", function () {
            var caseId = $(".caseId").val();
            var url = "/Admin/case?caseId=" + caseId;
            window.location.href = url;

        });
    });
</script>

 